<html>
<head>
  <title>Point mapping through 3D transforms</title>
  <script src="point-mapping-helpers.js" type="text/javascript" charset="utf-8"></script>
  
  <script type="text/javascript" charset="utf-8">
    
    function test()
    {
      dispatchEvent(44, 44, 'box1', 1, 1);
      dispatchEvent(69, 55, 'box2', 1, 1);
      dispatchEvent(165, 182, 'box2', 95, 95);
      dispatchEvent(333, 79, 'box7', 1, 1);
      dispatchEvent(87, 325, 'box10', 1, 1);
      dispatchEvent(196, 467, 'box10', 97, 97);
      dispatchEvent(333, 325, 'box13', 1, 1);
      dispatchEvent(353, 352, 'box14', 1, 1);
      dispatchEvent(472, 507, 'box14', 96, 96);
    }
    
  </script>
  <style type="text/css" media="screen">
  
    body {
      margin: 0;
      border: 1px solid black;
      cursor: crosshair;
    }

	.one {
      top: 1px;
      left: 1px;
	}
	.two {
      top: 1px;
      left: 247px;
	}
	.three {
      top: 247px;
      left: 1px;
	}
	.four {
      top: 247;
      left: 247px;
	}
	
    .test {
      position: absolute;
      height: 200px;
      width: 200px;
      border: 1px solid black;
      margin: 20px;
    }

    .box {
      height: 100px;
      width: 100px;
      -webkit-box-sizing: border-box;
      background-color: #DDD;
      border: 1px solid black;
    }

    .box:hover {
      outline: 3px solid orange;
    }
    
    .container {
      height: 140px;
      width: 140px;
      margin: 20px;
      border: 1px solid black;
      -webkit-box-sizing: border-box;
      -webkit-perspective: 400;
    }
    
    .transformed {
      position: relative;
      height: 100px;
      width: 100px;
      padding: 20px;
      margin: 20px;
      border: 1px solid black;
      background-color: #AAA;
      -webkit-box-sizing: border-box;
      transform: translateZ(100px) rotateY(-40deg);
    }
    
    .layer {
      padding: 20px;
      background-color: #C0D69E;
    }

    .inner {
      background-color: blue;
    }
    
    #results {
      position: absolute;
      left: 30px;
      top: 500px;
    }
    
    #mousepos {
      position: absolute;
      left: 30px;
      top: 700px;
      color: gray;
      font-size: smaller;
    }
  </style>
</head>
<body onclick="clicked(event)">

<div id="results"></div>

<div class="test one">
  <!-- Simple transformed div in perpsective -->
  <div class="container box" id="box1">
    <div class="transformed box" id="box2">
    </div>
  </div>
</div>

<div class="test two">
  <!-- Transformed div in perpsective with non-layer child -->
  <div class="container box" id="box5">
    <div class="transformed box" id="box6">
      <div class="inner box" id="box7">
      </div>
    </div>
  </div>
</div>

<div class="test three">
  <!-- Transformed div in perpsective with layer child -->
  <div class="container box" id="box8">
    <div class="transformed box" id="box9">
      <div class="inner box" style="position: relative" id="box10">
      </div>
    </div>
  </div>
</div>

<div class="test four">
  <!-- Transformed div in perpsective with child having layer child -->
  <div class="container box" id="box11">
    <div class="transformed box" id="box12">
      <div class="layer box" id="box13">
        <div class="inner box" style="position: relative" id="box14">
        </div>
      </div>
    </div>
  </div>
</div>

<div id="mousepos"></div>

</body>
</html>
